package com.zhuiyun.project.api.coachmanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.zhuiyun.project.api.coachApply.entity.CoachApply;
import com.zhuiyun.project.api.coachApply.mapper.CoachApplyMapper;
import com.zhuiyun.project.api.coachmanagement.entity.CoachManagement;
import com.zhuiyun.project.api.coachmanagement.mapper.CoachManagementMapper;
import com.zhuiyun.project.api.coachmanagement.model.*;
import com.zhuiyun.project.api.coachmanagement.service.CoachManagementService;
import com.zhuiyun.project.api.memberUserManagement.entity.MemberUserManagement;
import com.zhuiyun.project.api.memberUserManagement.mapper.MemberUserManagementMapper;
import com.zhuiyun.project.api.reservation.mapper.ReservationMapper;
import com.zhuiyun.project.api.vipPlan.entity.MemberPlan;
import com.zhuiyun.project.api.vipPlan.mapper.MemberPlanActionMapper;
import com.zhuiyun.project.api.vipPlan.mapper.MemberSeriesMapper;
import com.zhuiyun.project.api.vipPlan.mapper.VipPlanMapper;
import com.zhuiyun.project.api.vipPlan.model.ActionListModel;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.errorCode.EmErrorCode;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.*;
import com.zhuiyun.project.utils.pageUtil.MybatisPageHelper;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import com.zhuiyun.project.utils.uuid.IdUtils;
import com.zhuiyun.project.utils.validator.ValidatorUtil;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

import static com.zhuiyun.project.config.RabbitMqConfig.LIVE_EXCHANGE;
import static com.zhuiyun.project.config.RabbitMqConfig.LIVE_ROUTING_KEY;

/**
 * @ClassName CoachManagementServiceImpl
 * @Description TODO
 * @Author wuwan
 * @Date 2023/11/2 13:39
 **/
@Service
public class CoachManagementServiceImpl extends ServiceImpl<CoachManagementMapper, CoachManagement> implements CoachManagementService {
    @Resource
    private CoachManagementMapper coachManagementMapper;
    // todo 加密工具类
    @Resource
    private BCryptPasswordEncoder bCryptPasswordEncoder;
    @Resource
    private MemberUserManagementMapper memberUserManagementMapper;

    @Resource
    private VipPlanMapper vipPlanMapper;

    @Resource
    private CoachApplyMapper coachApplyMapper;

    @Resource
    private ReservationMapper reservationMapper;

    @Resource
    private MemberSeriesMapper memberSeriesMapper;



    /*
     * @Author wuwan
     * @Description 添加教练信息
     * @Date 2023/11/2 14:04
     * @Return
     */
    @Override
    public CommonResult addCoach(CoachAddModel coachAddModel, MultipartFile[] files) throws CommonException {
        // 判断file对象是否为空
        if(ValidatorUtil.ValidationObject(coachAddModel)){
            // 验证参数
            CoachManagement coachManagement = new CoachManagement();
            // coachAddModel 对象拷贝成 coachManagement
            BeanUtils.copy(coachAddModel, coachManagement);
            StringBuilder stringBuilder = new StringBuilder();
            if (files != null) {
                for (MultipartFile multipartFile : files) {
                    String i = UploadFileUtils.uploadFile(multipartFile);
                    if (stringBuilder.length() > 0) {
                        stringBuilder.append("," + i);
                    } else {
                        stringBuilder.append(i);
                    }
                }
            }
            if (stringBuilder.length() > 0) {
                coachManagement.setCoachImg(stringBuilder.toString());
            } else {
                coachManagement.setCoachImg("");
            }
            // 密码加密
            String encode = bCryptPasswordEncoder.encode(coachAddModel.getCoachPhone());
            coachManagement.setCoachPassword(encode);
            // 生成教练邀请码
            String s1 = IdUtils.randomUUID();
            String subString = s1.substring(9, 9 + 14);
            coachManagement.setCoachCode(subString);

            Integer integer = coachManagementMapper.addCoach(coachManagement);
            if (integer >= 1) {
                return CommonResult.ok(EmErrorCode.SAVE_OK);
            } else {
                return CommonResult.ok(EmErrorCode.SAVE_ERROR);
            }
        } else {
            return CommonResult.ok(EmErrorCode.SAVE_ERROR);
        }
    }

    @Override
    public CommonResult selectCoach(PageRequest pageRequest, String venueUniqueIdentifier, String coachName, String coachPhone) {
        MybatisPageHelper.startPage(pageRequest);
        List<CoachManagement> coachManagements = coachManagementMapper.selectCoach(venueUniqueIdentifier, coachName, coachPhone);
//        // 使用lambda遍历
//        coachManagements.forEach(coachManagement -> {
//            // 分割字符串
//            String coachFitness = coachManagement.getCoachFitness();
//            String[] split = coachFitness.split(",");
//            List<String> fitnessPurposeNames = new ArrayList<>();
//            //
//            for (String fitness : split) {
//                // 那遍历到的数据查询另一张表的name名
//                FitnessPurpose fitnessPurpose = coachManagementMapper.selectLabelName(Integer.valueOf(fitness));
//                fitnessPurposeNames.add(fitnessPurpose.getFitnessPurposeName());
//            }
//            // 拼接从新赋值
//            coachManagement.setCoachFitness(String.join(",", fitnessPurposeNames));
//        });
//        // 将处理过后的数据返回给前端
        return CommonResult.ok(MybatisPageHelper.getPageResult(coachManagements));
    }

    /*
     * @Author wuwan
     * @Description 修改教练信息
     * @Date 2023/11/10 10:20
     * @Return
     */
    @Override
    public CommonResult updVenue(CoachAddModel coachAddModel, MultipartFile[] files) throws CommonException {
        if (ValidatorUtil.ValidationObject(coachAddModel)) {
            //根据教练邀请码查询该教练的数据
            CoachManagement coach = coachManagementMapper.getCoachManagementImgById(coachAddModel.getId());
            StringBuilder stringBuilder = new StringBuilder();
            CoachManagement coachManagement = new CoachManagement();
            // coachAddModel 对象拷贝成 coachManagement
            BeanUtils.copy(coachAddModel, coachManagement);
            if(coach != null){
                String coachImg = coach.getCoachImg(); // // 获取已有的图片ID
                if (coachImg != null && !coachImg.isEmpty()) {
                    // 如果已有图片ID不为空，则先将其添加到stringBuilder中
                    stringBuilder.append(coachImg);
                }
                if (files != null) {
                    // todo 上传图片
                    for (MultipartFile multipartFile : files) {
                        String i = UploadFileUtils.uploadFile(multipartFile);
                        if (stringBuilder.length() > 0) {
                            stringBuilder.append("," + i);
                        } else {
                            stringBuilder.append(i);
                        }
                    }
                }
                // 上传图片
                if (stringBuilder.length() > 0) {
                    coachManagement.setCoachImg(stringBuilder.toString());
                } else {
                    coachManagement.setCoachImg("");
                }
            }
            // 密码加密
            String encode = bCryptPasswordEncoder.encode(coachAddModel.getCoachPhone());
            coachManagement.setCoachPassword(encode);
            // 修改教练信息
            Integer integer = coachManagementMapper.updCoach(coachManagement);
            if (integer >= 1) {
                return CommonResult.ok(EmErrorCode.UPDATE_OK);
            } else {
                return CommonResult.ok(EmErrorCode.UPDATE_ERROR);
            }
        } else {
            return CommonResult.ok(EmErrorCode.UPDATE_ERROR);
        }
    }

    /*
     * @Author wuwan
     * @Description 根据邀请码查询教练id
     * @Date 2023/11/6 10:10
     * @Return
     */
    @Override
    public CommonResult getCoachId(String coachCode) {
        return CommonResult.ok(coachManagementMapper.getCoachId(coachCode));
    }

    /**
     * @param id
     * @Author 杨友朋
     * @Description 根据id查询教练
     * @Date 2023/11/28 9:12
     * @Return CommonResult
     */
    @Override
    public CommonResult getCoachById(int id) {
        // 判断id是否合法
        if (id != 0) {
            // 根据id查询数据库
            CoachAddModel coachManagement = coachManagementMapper.getCoachById(id);
            // 判断查询结果
            if (coachManagement != null) {
                return CommonResult.ok(coachManagement);
            }
            return CommonResult.error(500, "查询失败");
        }
        return CommonResult.error(500, "参数校验失败");
    }

    /**
     * @param word,myWord
     * @Author 杨友朋
     * @Description 解密
     * @Date 2023/11/28 16:40
     * @Return Boolean
     */
    @Override
    public Boolean encryption(String word, String myWord) {
        // 校验输入密码word与原密码myWOrd是否相同
        boolean matches = bCryptPasswordEncoder.matches(word, myWord);
        return matches;
    }

    /**
     * @param coachUpPasswordModel
     * @Author 杨友朋
     * @Description 修改密码
     * @Date 2023/11/29 9:32
     * @Return CommonResult
     */
    @Override
    public CommonResult upPassword(CoachUpPasswordModel coachUpPasswordModel) throws CommonException {
        // 验证id规范性
        if (coachUpPasswordModel.getId() == null || coachUpPasswordModel.getId() == 0) {
            return CommonResult.error("参数校验失败");
        }
        // 验证参数的规范性
        if (ValidatorUtil.ValidationObject(coachUpPasswordModel)) {
            // 密码加密
            String encode = bCryptPasswordEncoder.encode(coachUpPasswordModel.getCoachPassword());
            coachUpPasswordModel.setCoachPassword(encode);
            // 创建实体对象
            CoachManagement coachManagement = new CoachManagement();
            // 模型对象赋值给实体对象
            BeanUtils.copy(coachUpPasswordModel, coachManagement);
            // 调用mapper接口对数据库进行操作
            int i = coachManagementMapper.updateById(coachManagement);
            if (i > 0) {
                return CommonResult.ok("修改成功");
            } else {
                return CommonResult.error("修改失败");
            }
        }
        return CommonResult.error("参数校验失败");
    }

    /**
     * @param coachUpSexModel
     * @Author 杨友朋
     * @Description 修改性别
     * @Date 2023/11/29 9:32
     * @Return CommonResult
     */
    @Override
    public CommonResult upSex(CoachUpSexModel coachUpSexModel) throws CommonException {
        // 验证id规范性
        if (coachUpSexModel.getId() == null || coachUpSexModel.getId() == 0) {
            return CommonResult.error("参数校验失败");
        }
        // 验证参数的规范性
        if (ValidatorUtil.ValidationObject(coachUpSexModel)) {
            // 创建实体对象
            CoachManagement coachManagement = new CoachManagement();
            // 模型赋值给实体对象
            BeanUtils.copy(coachUpSexModel, coachManagement);
            // 调用mapper接口对数据库进行操作
            int i = coachManagementMapper.updateById(coachManagement);
            // 判断操作是否成功
            if (i > 0) {
                return CommonResult.ok("修改成功");
            } else {
                return CommonResult.error("修改失败");
            }
        }
        return CommonResult.error("参数校验失败");
    }

    /**
     * @param coachUpNameModel
     * @Author 杨友朋
     * @Description 修改姓名
     * @Date 2023/11/29 9:32
     * @Return CommonResult
     */
    @Override
    public CommonResult upName(CoachUpNameModel coachUpNameModel) throws CommonException {
        // 验证id规范性
        if (coachUpNameModel.getId() == null || coachUpNameModel.getId() == 0) {
            return CommonResult.error("参数校验失败");
        }
        // 验证参数的规范性
        if (ValidatorUtil.ValidationObject(coachUpNameModel)) {
            // 创建实体对象
            CoachManagement coachManagement = new CoachManagement();
            // 模型赋值给实体对象
            BeanUtils.copy(coachUpNameModel, coachManagement);
            // 调用mapper接口对数据库进行操作
            int i = coachManagementMapper.updateById(coachManagement);
            // 判断操作是否成功
            if (i > 0) {
                return CommonResult.ok("修改成功");
            } else {
                return CommonResult.error("修改失败");
            }
        }
        return CommonResult.error("参数校验失败");
    }

    /**
     * @param coachCode
     * @Author 杨友朋
     * @Description 根据教练邀请码查询学员
     * @Date 2023/11/28 9:06
     * @Return CommonResult
     */
    @Override
    public CommonResult getStudentByTeacherId(String coachCode) {
        if (!StringUtils.isEmpty(coachCode)) {
            List<SelectStudentModel> memberUserManagements = coachManagementMapper.getStudentByTeacherId(coachCode);
            if (memberUserManagements != null) {
                for (int a = 0; a < memberUserManagements.size(); a++) {
                    if (memberUserManagements.get(a).getIsAllocation().equals("0")) {
                        List<ActionListModel> actionListModels = vipPlanMapper.memberSelectPlan(memberUserManagements.get(a).getId());
                        int over = 0;
                        for (int b = 0; b < actionListModels.size(); b++) {
                            if (actionListModels.get(b).getIsComplete().equals("0")) {
                                over++;
                            }
                        }
                        memberUserManagements.get(a).setSchedule(over + "/" + actionListModels.size());

                        // 判断完成课程数量是否等于总课程数量
                        if (over == actionListModels.size()) {
                            // 修改课程成为未分配状态
                            Integer integer = vipPlanMapper.updateIsAllocation(memberUserManagements.get(a).getId());
                            if (integer > 0) {
                                memberUserManagements.get(a).setIsAllocation("1");
                            }
                        }
                    }
                }
                return CommonResult.ok(memberUserManagements);
            } else {
                return CommonResult.error("查询失败");
            }
        }
        return CommonResult.error("参数校验失败");
    }

    /**
     * @param coachCode
     * @Author wuwan
     * @Description 根据教练邀请码查询学员
     * @Date 2023/11/28 9:06
     * @Return CommonResult
     */
    @Override
    public CommonResult getStudentByTeacherIdUser(Integer userid, String coachCode) {
        SelectStudentModel memberUserManagements = coachManagementMapper.getStudentByTeacherIdUser(userid, coachCode);
        int over = 0;
        List<ActionListModel> actionListModels = vipPlanMapper.memberSelectPlan(memberUserManagements.getId());
        for (int b = 0; b < actionListModels.size(); b++) {
            if (actionListModels.get(b).getIsComplete().equals("0")) {
                over++;
            }
        }
        memberUserManagements.setSchedule(over + "/" + actionListModels.size());
        return CommonResult.ok(memberUserManagements);
    }

    /**
     * @param venueUniqueIdentifier
     * @Author wx
     * @Description 根据invitationCode查询单教练的数据
     * @Date 2023/12/3 18:51
     * @Return
     */
    @Override
    public CommonResult selectByInvitationCode(Integer id, String invitationCode, String venueUniqueIdentifier) {
        // 查询是否有该教练
        CoachManagement coachManagement = coachManagementMapper.selectByInvitationCode(invitationCode, venueUniqueIdentifier);
        if (coachManagement == null) {
            return CommonResult.ok(null);
        } else {
            // 查询是否有申请
            CoachApply coachApply = coachApplyMapper.selectByInvitationCode(id, invitationCode, venueUniqueIdentifier);
            if (coachApply == null) {
                // 没有则添加
                int i = coachApplyMapper.addByInvitationCode(id, invitationCode, venueUniqueIdentifier);
                return CommonResult.ok(i);
            } else {
                return CommonResult.ok("you");
            }

        }

    }

    /**
     * @param venueUniqueIdentifier
     * @Author wx
     * @Description 根据用户ID查询单教练的数据
     * @Date 2023/12/4 10:19
     * @Return
     */
    @Override
    public CommonResult selectCoachByUserId(Integer id, String venueUniqueIdentifier) {
        MemberUserManagement memberUserManagement = memberUserManagementMapper.selectCoachByUserId(id, venueUniqueIdentifier);
        if (memberUserManagement != null && memberUserManagement.getInvitationCode() != null && memberUserManagement.getInvitationCode() != "") {
            return CommonResult.ok(memberUserManagement);
        } else {
            return CommonResult.ok(null);
        }
    }

    /**
     * @param invitationCode
     * @Author wx
     * @Description 根据邀请码查询单教练的数据
     * @Date 2023/12/4 10:48
     * @Return
     */
    @Override
    public CommonResult selectCoachByInvitationCode(String invitationCode, String venueUniqueIdentifier) {
        CoachManagement coachManagement = coachManagementMapper.selectByInvitationCode(invitationCode, venueUniqueIdentifier);
        return CommonResult.ok(coachManagement);
    }

    /**
     * @param venueUniqueIdentifier
     * @Author wx
     * @Description 根据邀请码查询邀请码申请的数据
     * @Date 2023/12/5 9:26
     * @Return
     */
    @Override
    public CommonResult selectCoachApplyByInvitationCode(String invitationCode, String venueUniqueIdentifier, Integer memberUserId) {
        CoachApply coachApply = coachApplyMapper.selectCoachApplyByInvitationCode(invitationCode, venueUniqueIdentifier, memberUserId);
        if (coachApply == null) {
            return CommonResult.ok(null);
        } else {
            if (coachApply.getApplyStatus() == 0) {
                return CommonResult.ok(coachApply);
            } else {
                return CommonResult.ok(coachApply);
            }
        }
    }

    /**
     * @param coachCode
     * @Author wx
     * @Description 根据邀请码查询教练申请
     * @Date 2023/12/5 15:46
     * @Return
     */
    @Override
    public CommonResult selectCoachInfoByCode(String coachCode) {
        return CommonResult.ok(coachApplyMapper.selectCoachInfoByCode(coachCode));
    }

    /**
     * @param memberUserId
     * @Author wx
     * @Description 添加用户的教练邀请码
     * @Date 2023/12/5 18:42
     * @Return
     */
    @Transactional
    @Override
    public CommonResult updateCoachCode(String coachCode, Integer memberUserId) throws CommonException {
        int i = coachApplyMapper.updateCoachCodeStatus(coachCode, memberUserId);
        //根据学员id查询未完成的会员训练计划
        List<MemberPlan> list = reservationMapper.getMemberPlanByStudentId(memberUserId);
        if (!list.isEmpty()) {
            //删除课程级计划
            try {
                list.forEach(item -> {
                    DeleteSeries(item.getSeriesId());
                    DeleteReservation(item.getId());
                    DeleteMemberPlan(item.getId());
                });
            } catch (NumberFormatException e) {
                throw new CommonException(EmErrorCode.DELETE_ERROR);
            }
        }
        //清空学员备注
        memberUserManagementMapper.deleteNotesById(memberUserId);
        //根据教练邀请码查询id
        CoachManagement coachManagement=memberUserManagementMapper.selectIdByCode(coachCode);
        //修改学员案例
        memberUserManagementMapper.UpdateUserRecordById(memberUserId, String.valueOf(coachManagement.getId()));
        if (i > 0) {
            return CommonResult.ok(memberUserManagementMapper.addByInvitationCode(coachCode, memberUserId));
        } else {
            return CommonResult.ok(0);
        }

    }

    @Override
    public CommonResult coachUpNotes(CoachUpNotesModel coachUpNotesModel) {
        if (coachUpNotesModel.getId() != null && coachUpNotesModel.getId() != 0) {
            int i = memberUserManagementMapper.coachUpNotes(coachUpNotesModel);
            if (i > 0) {
                return CommonResult.ok(EmErrorCode.UPDATE_OK);
            } else {
                return CommonResult.error(EmErrorCode.UPDATE_ERROR);
            }
        } else {
            return CommonResult.error(EmErrorCode.ID_NULL);
        }
    }

    /**
     * @param venueUniqueIdentifier
     * @return CommonResult
     * @Author shy   TODO 根据场地标识符查询所有教练
     * @Date 2024/2/29 20:05
     */
    @Override
    public CommonResult getCoachByVenueUniqueIdentifier(String venueUniqueIdentifier, String id) {
        if (ObjectUtils.isNotEmpty(venueUniqueIdentifier)) {
            List<CoachManagement> list = coachManagementMapper.getCoachByVenueUniqueIdentifier(venueUniqueIdentifier);
            List<CoachManagement> collect = list.stream().filter(item -> item.getId() != Integer.parseInt(id)).collect(Collectors.toList());
            if (ObjectUtils.isNotEmpty(collect)) {
                return CommonResult.ok(collect);
            } else {
                return CommonResult.error(EmErrorCode.ID_NOT_OBJECT);
            }
        } else {
            return CommonResult.error(EmErrorCode.ID_NULL);
        }

    }

    /**
     * @param coachHandoverModel
     * @return CommonResult
     * @Author shy  TODO 学员转交
     * @Date 2024/3/2 9:49
     */
    @Override
    @Transactional
    public CommonResult studentHandover(CoachHandoverModel coachHandoverModel) throws CommonException {
        //判断model对象是否为空
        if (ValidatorUtil.ValidationObject(coachHandoverModel)) {
            //查询是否有申请
            List<CoachApply> list1 = coachApplyMapper.selectByMemberId(coachHandoverModel);
            if (list1.size() <= 0) {
                //向新教练发送学员申请
                int i = coachApplyMapper.addInvitationCode(coachHandoverModel);
                if (i > 0) {
                    //ttl 过期时间  1秒=1000毫秒  一天的时间
                    int Day=24*60*60*1000;
                    RabbitMqUtils.sendMessage(coachHandoverModel.getId().toString(), LIVE_EXCHANGE, LIVE_ROUTING_KEY, String.valueOf(Day));
                }
            }
            return CommonResult.ok(EmErrorCode.UPDATE_OK);
        } else {
            return CommonResult.error(EmErrorCode.ID_NULL);
        }
    }

    /**
    * @Author 赵雷棚
    * @Description 根据教练id 删除教练中的图片id
    * @Date 2024/6/4 10:59
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param id
    * @param delImageId
    */
    @Override
    public CommonResult deletecoachImg(Integer id, Integer delImageId) {
        //根据id查询教练信息
        CoachManagement coach = coachManagementMapper.getCoachManagementImgById(id);
        StringBuilder stringBuilder = new StringBuilder();
        if(coach!= null){
            String coachImgStr = coach.getCoachImg();
            if(coachImgStr != null){
                //如果 coachImgStr 字符串中包含逗号，就将其按逗号分割成一个数组；如果不包含逗号，就创建一个只包含 coachImgStr 本身的数组。这样做的目的是为了统一处理单个或多个图片ID的情况。
                String[] coachImgs = coachImgStr.contains(",") ? coachImgStr.split(",") : new String[]{coachImgStr};
                if(coachImgs.length == 1){
                    for(String imgId : coachImgs){
                        if(!imgId.equals(delImageId.toString())){
                            stringBuilder.append(imgId);
                        }
                    }
                }else {
                    for(String imgId : coachImgs){
                        if(!imgId.equals(delImageId.toString())){
                            if(stringBuilder.length() >0) {
                                stringBuilder.append("," + imgId);
                            }else {
                                stringBuilder.append(imgId);
                            }
                        }
                    }
                }
            }
        } else {
            return CommonResult.error(EmErrorCode.UPDATE_ERROR);
        }
        if(stringBuilder.length() > 0){
            coach.setCoachImg(stringBuilder.toString());
        } else {
            coach.setCoachImg("");
        }
        UpdateWrapper<CoachManagement> coachManagementUpdateWrapper = new UpdateWrapper<>();
        coachManagementUpdateWrapper.eq("id", id);
        coachManagementMapper.update(coach, coachManagementUpdateWrapper);
        return CommonResult.ok(EmErrorCode.UPDATE_OK);
    }

    //deleteImageById是一个处理删除图片的方法
    private boolean deleteImageById(String imgId) {
        return false;
    }

    /**
     * @param id
     * @Author shy   TODO 删除课程
     * @Date 2024/3/1 15:53
     */
    public void DeleteSeries(Integer id) {
        memberSeriesMapper.deleteById(id);
    }

    /**
     * @param id
     * @Author shy TODO 删除训练预约表
     * @Date 2024/3/1 15:52
     */
    public void DeleteReservation(Integer id) {
        reservationMapper.DeleteReservation(id);
    }

    /**
     * @param id
     * @Author shy  TODO 删除用户训练计划中间表
     * @Date 2024/3/1 15:52
     */
    public void DeleteMemberPlan(Integer id) {
        coachManagementMapper.DeleteMemberPlan(id);
    }
}
